package com.rory.gooday.diary;

import com.rory.gooday.common.model.Diary;
import com.jfinal.plugin.activerecord.Page;

public class DiaryService {

	private final Diary diaryDao = new Diary().dao();


	public Page<Diary> paginate(int pageNumber, int pageSize) {
		Page<Diary> b = diaryDao.paginate(pageNumber, pageSize, "SELECT *", "FROM diary order by diary_date desc,id desc");
		return b;
	}
	
	public Diary findById(int id) {
		return diaryDao.findById(id);
	}

	public void deleteById(int id) {
		diaryDao.deleteById(id);
	}
}
